<%@ page language="java" contentType="text/html;" pageEncoding="UTF-8"%>
<%@ page import="com.huike.stu.domain.Student" %>
<jsp:useBean id="student" scope="request" class="com.huike.stu.domain.Student"></jsp:useBean>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>修改学生</title>
		<style type="text/css">
			table {
				border: 1px solid black;
				border-collapse: collapse;
				margin: auto;
			}
			td {
				border: 1px solid black;
				text-align: center;
			}
			tr {
				height: 36px;
			}
		</style>
		<script type="text/javascript">
			function showDept() {
				var depts = document.getElementById("dept");
				for (var i = 0; i < depts.length; i++) {
					if (depts[i].value == "<%=student.getDept()%>") {
						depts[i].selected = true;
					}
				}
				
			}
		</script>
	</head>
	<body onload="showDept()">
		
		<form name="stuEditForm" action="<%=request.getContextPath() %>/update" method="post">
			<table>
				<tr>
					<td width="80px">学号</td>
					<td width="300px">
						<input type="text" name="no" readonly="readonly" value="<%=student.getNo() %>"/>
					</td>
				</tr>
				<tr>
					<td>姓名</td>
					<td>
						<input type="text" name="name" value="<%=student.getName() %>"/>
					</td>
				</tr>
				<tr>
					<td>性别</td>
					<td>
						<%
							if (student.getSex().equals("male")) {
						%>
						<input type="radio" name="sex" value="male" checked="checked"/>男
						<input type="radio" name="sex" value="female"/>女
						<% 
							} else {
						%>
						<input type="radio" name="sex" value="male"/>男
						<input type="radio" name="sex" value="female"  checked="checked"/>女
						<%		
							}
						%>
					</td>
				</tr>
				<tr>
					<td>年龄</td>
					<td>
						<input type="text" name="age" value="<%=student.getAge() %>"/>
					</td>
				</tr>
				<tr>
					<td>专业</td>
					<td>
						<select name="dept" id="dept">
							<option value="计算机科学与技术">计算机科学与技术</option>
							<option value="网络工程">网络工程</option>
							<option value="通信工程">通信工程</option>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="submit" value="保存"/>
					</td>
				</tr>		
			</table>
		</form>
	</body>
</html>